feat: add transaction splitting tools#13
Merged
Conversation
Surface the community fork's split methods as two new MCP tools: - get_transaction_splits(transaction_id): read the current split legs - update_transaction_splits(transaction_id, splits): full-replace the split set; an empty list removes all splits and restores the single un-split transaction Inputs use a typed TransactionSplit model (amount + optional category_id, merchant_name, notes) and are translated into the API's camelCase splitData shape. Monarch validates that leg amounts sum to the parent total and its rejection payload is surfaced as a clear error. Adds tests/test_splits.py (8 cases) plus coverage-matrix and tool-count test updates, and refreshes CLAUDE.md tool/test counts.
jamiew
added a commit
that referenced
this pull request
Jun 30, 2026
- transaction splitting tools (#13) and session-dir fix (#12), both from @caseypugh - dependency refresh and fork-pin bump to 1.4.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for transaction splitting by surfacing the community fork's existing split methods as two new MCP tools. Splitting lets a single transaction be divided across multiple categories (e.g. a Target run that's part groceries, part household).
get_transaction_splits(transaction_id)(read-only) — returns the current split legs, whether the transaction is split, and each leg's amount/category/merchant/notes.update_transaction_splits(transaction_id, splits)(write, idempotent) — full-replace semantics: the splits you pass become the complete set, replacing any existing ones. Pass an empty list to remove all splits and restore the single un-split transaction.Inputs use a typed
TransactionSplitmodel (amount+ optionalcategory_id,merchant_name,notes), translated into the API's camelCasesplitDatashape. Monarch validates that leg amounts sum to the parent total; its rejection payload is surfaced as a clearValueErrorrather than swallowed. Both tools follow the existing patterns —api_call_with_retry, structured logging, 30s timeout, typed Pydantic structured output.This brings the tool count from 19 → 21.
Example
Split a -100.00 transaction into groceries and household:
Testing
tests/test_splits.py(8 cases): split retrieval, payload translation, merchant defaulting, split removal via empty list, and API-error surfacing.test_tool_coverage.py.test_structured_output.py.uv run python scripts/ci.py— ruff check, ruff format, mypy, and pytest all pass (206 passed, 5 skipped).